// 展开语法（Spread syntax）
// 可以在函数调用/数组构造时，将数组表达式或者string在语法层面的展开
// 还可以在构造字面量对象时，将对象表达式按key-value的方式展开
const names = ["abc","cba","nba"]
const name = "why"
const info={name:"why",age:18}

//1.函数调用时
function foo(x,y,z){
    console.log(x,y,z)
}

//foo.apply(null,names)
foo(...names)
foo(...name)

// 2. 构造数组时
const newNames = [...names,...name]
console.log(newNames)

// ES2018(ES9)
const obj={ ...info,address:"广州市" }
console.log(obj)